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