UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'eE65cDWJ+UY2uEyg8BpitjQEYT3ePt3X5vUufOtTrFI='
WHERE
key_id = 'c216181af8dcb07778efd11f535d122b5cb5c61796a48d0ec1183b50e2f52767'
AND (
token = 'eE65cDWJ+UY2uEyg8BpitjQEYT3ePt3X5vUufOtTrFI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)