UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'y2FYCFARE1iUBnuPD9mklz+y3oQ/5ZvGeiBmRlrQIdU=' 
WHERE 
  key_id = 'f4193107eddd9bd6a8a0a1c7501473de69321445e2d6438eca71682745e6b5e1' 
  AND (
    token = 'y2FYCFARE1iUBnuPD9mklz+y3oQ/5ZvGeiBmRlrQIdU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032