UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tFo8T6QID0nvQ8WozVe399MLICHG1vAMS6fSxpkyyLY='
WHERE
key_id = 'a109e272326041059e0c44faad269c4d0987660c823b6ec762ae731fb4bf7b68'
AND (
token = 'tFo8T6QID0nvQ8WozVe399MLICHG1vAMS6fSxpkyyLY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)