UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'OSPrVI3q7f4i+yV8T6E8sNukUqT0LRBNtCOVmLcKYDA='
WHERE
key_id = '5a317e79a899f05edf33a12b714d563b8e0ba9aecf741f806fc4e8136a340157'
AND (
token = 'OSPrVI3q7f4i+yV8T6E8sNukUqT0LRBNtCOVmLcKYDA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)