UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Z+6WFEOZv3zGd5irpgSgHdV3csFBTfaYIViqxdHquoA='
WHERE
key_id = 'd1c75a2e7f2b0504839ea45b3e5e9ecc6aceed92b0d3a4a314cca925c7525dd4'
AND (
token = 'Z+6WFEOZv3zGd5irpgSgHdV3csFBTfaYIViqxdHquoA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)