UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'OiPc04wSkHEGsAfFAiQE/sAeoOE9WckqhjdIwROxOSk='
WHERE
key_id = 'd6f2d5a118940b00ebea0305eaf6bb84d2906dde085b2b88f8327f284133a198'
AND (
token = 'OiPc04wSkHEGsAfFAiQE/sAeoOE9WckqhjdIwROxOSk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)