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