UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8k8XvArv5jrUvgR88Fu/Fzsc/dCAt0/N2Tvygv0qERE=' 
WHERE 
  key_id = 'dcede3eecd860bb47d73044c3e97a748af09c9f8297745693693004ec07d2267' 
  AND (
    token = '8k8XvArv5jrUvgR88Fu/Fzsc/dCAt0/N2Tvygv0qERE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026