UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Xoh0ozn7lqZmM7RwgEqWuy4+xdl0ZFsBOzbclYTtJkU=' 
WHERE 
  key_id = '7dc14a33173f6c1339026d09b6013542ef84134556284bfa317ef80abd814b79' 
  AND (
    token = 'Xoh0ozn7lqZmM7RwgEqWuy4+xdl0ZFsBOzbclYTtJkU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00081