UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7gcB/JXf8A0MFOLU/RFgKjRQoIG3t43g2R0w1E0yT1Y=' 
WHERE 
  key_id = '4c20223b823612a3988404319b0d2e96dddd676fddd9e25caf7b742118ba6de1' 
  AND (
    token = '7gcB/JXf8A0MFOLU/RFgKjRQoIG3t43g2R0w1E0yT1Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045