UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tsdadVJnanAYYbIy1P/02rc7tiyXtwbuBV9qnSltFBg=' 
WHERE 
  key_id = 'd18a54d0ebb13bf32d218c8e6ecf810483beb71cb65def1f205f725065965d5b' 
  AND (
    token = 'tsdadVJnanAYYbIy1P/02rc7tiyXtwbuBV9qnSltFBg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031