UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oT7iEYTdzZanqJpEHK2gIveDvI72rhtc3IDJuzb1akM='
WHERE
key_id = '0b5e8b3fc8b8e6042f3a7dcf39609ef1a598589937661a40fa67daf15424409e'
AND (
token = 'oT7iEYTdzZanqJpEHK2gIveDvI72rhtc3IDJuzb1akM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)