UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'shAaN4H5Yb+n1ynJLMRVC20el48G3jAn+dbFvx2bPR8=' 
WHERE 
  key_id = '23c887a6a3e51103a33d514b321ed0ab679e6153ed0bd0ce184f1ea05c78fca0' 
  AND (
    token = 'shAaN4H5Yb+n1ynJLMRVC20el48G3jAn+dbFvx2bPR8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024