UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Fv7Dsnvfqdvvc88gYEDqS9zk8NrgdfxoYlekAkP1Mj8=' 
WHERE 
  key_id = '8e43ff02400ee3a7fcb95860251796e19e1f7d07628f7f4e16b4b0c901ea77b5' 
  AND (
    token = 'Fv7Dsnvfqdvvc88gYEDqS9zk8NrgdfxoYlekAkP1Mj8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00073