UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GBncb173kXYGD1DUHLi3cJLfyOj6+Up5Xyptd/FerWk='
WHERE
key_id = 'a504a1f11ec1d64ec673c9ffee0abf796251e62f6bd4c6ed18c3cc032fd56a4b'
AND (
token = 'GBncb173kXYGD1DUHLi3cJLfyOj6+Up5Xyptd/FerWk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)