UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IyIuZMxubXxXxVqQuztPHqz9NFCcDy83zz7q/pXOs7c='
WHERE
key_id = 'a5fadafbe088627be5e9582af7a23c62881783fd89d587e302106e4d3af9ee8f'
AND (
token = 'IyIuZMxubXxXxVqQuztPHqz9NFCcDy83zz7q/pXOs7c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)