UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1AkPMHOBx+ieyJq9l8XCRsbTY28f6D9PAYqeZL53QbM='
WHERE
key_id = 'b014d176bfc6a0e1fe67e8f440e1d856aa65b862a09f223b31798a917214162f'
AND (
token = '1AkPMHOBx+ieyJq9l8XCRsbTY28f6D9PAYqeZL53QbM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)