UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tHTb7IaLrpfGrX1tm++mTQBqJsLqu/j5oNV23AoK9aE=' 
WHERE 
  key_id = 'ce24d9bec706ab091912498707c198e5c5d53ce454085c8e406e916917b365dc' 
  AND (
    token = 'tHTb7IaLrpfGrX1tm++mTQBqJsLqu/j5oNV23AoK9aE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041