UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'r89aKoypf1PsF2klkmBIKdzil91o/LZr3wrdQx/TScE='
WHERE
key_id = 'c3a520349fc84cadfd9b17b1b08db32529d0c47031c46c73ebe1f514ef404f73'
AND (
token = 'r89aKoypf1PsF2klkmBIKdzil91o/LZr3wrdQx/TScE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)