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