UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PF0+h04ycxda1sELUPbRJAjWPkLGBdgAMu0831A/7zg=' 
WHERE 
  key_id = 'eb145314051d41c3e49d5dc01c0570a14c337a9f663fed3fd7187ee53d2e99b3' 
  AND (
    token = 'PF0+h04ycxda1sELUPbRJAjWPkLGBdgAMu0831A/7zg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046