UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'V++rjDSmFQtvaLEfG1fvjaIwF+Z+liI/jd9hYqAZ404='
WHERE
key_id = 'c87419d0188e6c883c4cb0bcf418811bb6cd5af269b9e393449be3db7496a9de'
AND (
token = 'V++rjDSmFQtvaLEfG1fvjaIwF+Z+liI/jd9hYqAZ404='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)