UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lWqjkBng/zbi3CiR0QGM2B37PBaKwSsn7/q1YQUF/B0=' 
WHERE 
  key_id = 'f398492e6c0295c4704ce3fb29d25b0be91b23372239c42f9fa5f29b1906e37b' 
  AND (
    token = 'lWqjkBng/zbi3CiR0QGM2B37PBaKwSsn7/q1YQUF/B0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025