UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PNpTE6tgt1nd2j3PoMFXVB2RfgexfNL0PSmYTGHtsYw='
WHERE
key_id = '2a1183cc6b0e0607e349cba790d041c800b06171d973f5e637dda17ac53c2632'
AND (
token = 'PNpTE6tgt1nd2j3PoMFXVB2RfgexfNL0PSmYTGHtsYw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)