UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IzDTKtovPxUTVNKxzzKdRCGiIrQC84ya3L5F0fq00pE='
WHERE
key_id = 'ba125e2761f33f8b1230e865306b38265faa5ecbf0b0bde0034ae8a926fd3387'
AND (
token = 'IzDTKtovPxUTVNKxzzKdRCGiIrQC84ya3L5F0fq00pE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)