UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'c6q3jSpsnO0H7klFHQNKSnepv5QXpWe5WiKwDkUtSh0='
WHERE
key_id = '55c9015a274e9dfea4953070d29a46e9195ccf080d47d6be9a1729bff1e51520'
AND (
token = 'c6q3jSpsnO0H7klFHQNKSnepv5QXpWe5WiKwDkUtSh0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)