UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '50WqIYkcb2ge5EMap6Qq++Qu2fCkQciiWQ3/rGRi7xE='
WHERE
key_id = '883bd47342c0a0a57f808a16acd2d7a898d9b2098111486ee2f4e32beaa7a175'
AND (
token = '50WqIYkcb2ge5EMap6Qq++Qu2fCkQciiWQ3/rGRi7xE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)