UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k3uIUgqYkNlntelR0sV67tWOzkva3Fv/sYrajzjgkv8=' 
WHERE 
  key_id = 'aec6d647f50671fa4c67f7531bd888b3fe644107be5584490b1ab2e244b027f4' 
  AND (
    token = 'k3uIUgqYkNlntelR0sV67tWOzkva3Fv/sYrajzjgkv8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032