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